// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   DecoratingClassLoader.java

package org.springframework.core;

import java.util.*;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

public abstract class DecoratingClassLoader extends ClassLoader
{

	protected static final boolean parallelCapableClassLoaderAvailable;
	private final Set excludedPackages;
	private final Set excludedClasses;
	private final Object exclusionMonitor;

	public DecoratingClassLoader()
	{
		excludedPackages = new HashSet();
		excludedClasses = new HashSet();
		exclusionMonitor = new Object();
	}

	public DecoratingClassLoader(ClassLoader parent)
	{
		super(parent);
		excludedPackages = new HashSet();
		excludedClasses = new HashSet();
		exclusionMonitor = new Object();
	}

	public void excludePackage(String packageName)
	{
		Assert.notNull(packageName, "Package name must not be null");
		synchronized (exclusionMonitor)
		{
			excludedPackages.add(packageName);
		}
	}

	public void excludeClass(String className)
	{
		Assert.notNull(className, "Class name must not be null");
		synchronized (exclusionMonitor)
		{
			excludedClasses.add(className);
		}
	}

	protected boolean isExcluded(String className)
	{
		Object obj = exclusionMonitor;
		JVM INSTR monitorenter ;
		if (excludedClasses.contains(className))
			return true;
		Iterator iterator = excludedPackages.iterator();
_L4:
		if (!iterator.hasNext()) goto _L2; else goto _L1
_L1:
		String packageName = (String)iterator.next();
		if (!className.startsWith(packageName)) goto _L4; else goto _L3
_L3:
		true;
		obj;
		JVM INSTR monitorexit ;
		return;
_L2:
		obj;
		JVM INSTR monitorexit ;
		  goto _L5
		Exception exception;
		exception;
		throw exception;
_L5:
		return false;
	}

	static 
	{
		parallelCapableClassLoaderAvailable = ClassUtils.hasMethod(java/lang/ClassLoader, "registerAsParallelCapable", new Class[0]);
		if (parallelCapableClassLoaderAvailable)
			ClassLoader.registerAsParallelCapable();
	}
}
